Polymorphic Constraint-Based Type Inference for Objects

نویسندگان

  • TIEJUN WANG
  • SCOTT F. SMITH
چکیده

Constraint-based type inference infers types with subtyping constraints. Such types can capture detailed data and control flow information about the analyzed program. In the presence of polymorphism, existing constraint-based type inference algorithms sacrifice much precision for efficiency. This paper presents both theoretical and practical results on developing precise and efficient polymorphic constraint-based type inference for object-oriented languages. We develop a novel theoretical framework for polymorphic constraint-based type inference. A concrete type inference algorithm can be obtained by instantiating the framework with a particular strategy for handling polymorphism. We define well-known algorithms such as Shivers’ nCFA and Agesen’s Cartesian Product Algorithm (CPA) as instantiations of the framework. We prove the soundness of the framework, which entails the soundness of every algorithm defined as an instantiation of the framework. Using the framework, we develop a novel algorithm, Data Polymorphic CPA (DCPA), which extends Agesen’s CPA Algorithm to achieve high precision in the presence of Data Polymorphism. We further study the construction of practical constraint-based type inference systems for realistic programming languages. We have constructed a type inference system for the full Java language. The system includes implementations of the 0CFA, CPA and DCPA algorithms, and it incorporates a number of novel implementation techniques for achieving scalability. The system is used to statically verify the correctness of Java downcasts. Benchmark results on realistic Java applications show that the DCPA algorithm has good precision and efficiency: it is significantly more accurate than existing algorithms and its efficiency is comparable to CPA.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Towards Constraint-based Type Inference with Polymorphic Recursion for Functional and Logic Programs

Type inference in the context of polymorphic recursion is notoriously difficult. The extensions to the traditional λ-calculus type inference algorithm by both Hindley-Milner and Mycroft are not capable of deriving the most general, i.e. principal types for programs with polymorphic recursion. Henglein has proposed a different algorithm, based on arrow graph reweriting, with an extended occurs c...

متن کامل

Fine-grained Information Flow Analysis for a λ-calculus with Sum Types (Full version)

This paper presents a new type system tracing information flow for a λ-calculus equipped with polymorphic “let” and with sums (a.k.a. union types or polymorphic variants). The type system allows establishing (weak) noninterference properties. Thanks to original forms of security annotations and constraints, it is more accurate than existing analyses. Through a straightforward encoding into sums...

متن کامل

Fine-grained Information Flow Analysis for a -calculus with Sum Types

This paper presents a new type system tracing information flow for a -calculus equipped with polymorphic “let” and with sums (a.k.a. union types or polymorphic variants). The type system allows establishing (weak) noninterference properties. Thanks to original forms of security annotations and constraints, it is more accurate than existing analyses. Through a straightforward encoding into sums,...

متن کامل

Precise Inference of Polymorphic Constrained Types

This paper develops a precise polymorphic type inference algorithm. Several methods for polymorphic type inference have been developed, including let-polymorphism and flow-based approaches such as Agesen’s Cartesian Product Algorithm (CPA). In this paper we focus on the flow-based variety. There is a class of polymorphic behavior which CPA misses: so-called data polymorphism. In the context of ...

متن کامل

An Unboxed Operational Semantics for ML Polymorphism

We present an unboxed operational semantics for an ML-style polymorphic language. Different from the conventional formalisms, the proposed semantics accounts for actual representations of run-time objects of various types, and supports a refined notion of polymorphism that allows polymorphic functions to be applied directly to values of various different representations. In particular, polymorp...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2005